textiter: fix bug in gtk_text_iter_backward_line()
authorNelson Benítez León <nbenitezl+gnome@gmail.com>
Fri, 10 Feb 2017 18:29:41 +0000 (23:29 +0500)
committerNelson Benítez León <nbenitezl+gnome@gmail.com>
Fri, 17 Feb 2017 14:49:55 +0000 (19:49 +0500)
commitaa483990027231d62ddcddec6b5b3c09b5d794aa
tree9e4bdf4015fd43ac6bfe430b31e89b3485ea6e9a
parent0c09e4776dae0c1b1f90d0de3bb16065d9ff7751
textiter: fix bug in gtk_text_iter_backward_line()

gtk_text_iter_backward_line() checks the value of
real->line_char_offset without previously calling
ensure_char_offsets (real) to make sure the former
is up-to-date.

As a consequence of this, when gtk_text_iter_backward_line()
is called after a gtk_text_buffer_insert_range() in the
first line of buffer, the iter is not moved to the start of
the line, and the return value is wrong.

Fixed by adding the ensure_char_offsets() call.

A test case for this bug is added to the textiter gtk testsuite.
gtk/gtktextiter.c
testsuite/gtk/textiter.c